package com.rub.android.ui.activity

import com.rub.android.R
import com.rub.android.base.BaseActivity
import com.rub.android.jetpack.model.ParcelUser
import kotlinx.android.synthetic.main.activity_button.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast


class ButtonActivity : BaseActivity() {

    override fun getLayoutId(): Int = R.layout.activity_button

    override fun initView() {

        btn.setOnClickListener {

            /**
             * 方法1
             */
           /* var intent = Intent(this, IntentActivity::class.java)
            var bundle = Bundle()
            bundle.putParcelable("parcelUser", ParcelUser(null, 90))
            intent.putExtras(bundle)
            startActivity(intent)*/

            /**
             * 方法2,使用anko封装的startActivity,底层代码是Pair<String, Any?>实现
             *
             * https://github.com/Kotlin/anko/wiki/Anko-Commons-%E2%80%93-Intents
             */
            startActivity<IntentActivity>("parcelUser" to ParcelUser(null, 90))
            //方法3
           // startActivity<IntentActivity>(Pair("parcelUser",ParcelUser(null, 90)))


        }
    }
}